package com.stars.empoly.activity

import android.view.View
import com.stars.empoly.adapter.InvoiceListAdapter
import com.stars.empoly.base.MBRActivity
import com.stars.empoly.databinding.ActivityInvoiceListBinding
import com.stars.empoly.model.InvoiceData
import com.stars.empoly.vmodel.InvoiceListVModel
import com.trailer.base.net.IResp

/**
 *on 2021/5/18
 */
class InvoiceListActivity: MBRActivity<InvoiceListVModel, InvoiceListAdapter, ActivityInvoiceListBinding>()  {


    override fun title(): String? {
        return "我的申请列表"
    }
    override fun vmClass(): Class<InvoiceListVModel> {
        return InvoiceListVModel::class.java
    }

    override fun binding(): ActivityInvoiceListBinding {
       return ActivityInvoiceListBinding.inflate(layoutInflater)
    }

    override fun initAdapter(): InvoiceListAdapter {
        return InvoiceListAdapter(vm)
    }

    override fun onListReceive(res: IResp<*>) {
        super.onListReceive(res)

        if (null != res) {

            var list = res.data() as List<InvoiceData>
            if (list.isEmpty() && vm.repository().page == 1) {

                binding.listEmpty.visibility = View.VISIBLE
            } else {
                binding.listEmpty.visibility = View.GONE
            }

        }
    }
}
